package com.wang.Tools;

import java.sql.Connection;
import java.sql.SQLException;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class c3p0Util {

	private static ComboPooledDataSource cpds = new ComboPooledDataSource();

	public static ComboPooledDataSource getCpds() {
		return cpds;
	}

	public static Connection getConnection() {

		Connection conn = null;
		try {
			conn = cpds.getConnection();
			System.out.println("success");
		} catch (SQLException e) {

			e.printStackTrace();
		}

		return conn;

	}

	public static void closeConn(Connection conn) {
		if (conn != null) {
			try {
				conn.close();
			} catch (SQLException e) {

				e.printStackTrace();
			}
		}
	}
}
